#!/usr/local/bin/perl

open (SENDMAIL, "| /usr/bin/sendmail -t -i");    # The -t is so sendmail scans the message for recipients (To:, Cc:, Bcc:)
                                                  # The -i is so sendmail doesn't interpret a line with only a . as the end of file
print SENDMAIL << 'EOF';
To:to@domain.com
From:from@domain.com
Subject:subject
body of 
  the mail
EOF

close(SENDMAIL);
